// CmdAdd.cpp : implementation file
//

#include "stdafx.h"
#include "Measure.h"
#include "CmdAdd.h"
#include "afxdialogex.h"


// CCmdAdd dialog

IMPLEMENT_DYNAMIC(CCmdAdd, CDialogEx)

CCmdAdd::CCmdAdd(CWnd* pParent, CMeasureProject& project)
	: CDialogEx(CCmdAdd::IDD, pParent)
  , project_(project)
  , name_(_T("cmd"))
  , cmd_(_T("cmd"))
  , serial_(_T(""))
{

}

CCmdAdd::~CCmdAdd()
{
}

void CCmdAdd::DoDataExchange(CDataExchange* pDX)
{
  CDialogEx::DoDataExchange(pDX);
  DDX_Text(pDX, IDC_CMD_NAME, name_);
  DDX_Text(pDX, IDC_CMD_CMD, cmd_);
  DDX_CBString(pDX, IDC_CMD_SERIAL, serial_);
  DDX_Control(pDX, IDC_CMD_SERIAL, wnd_serial_list_);
}


BEGIN_MESSAGE_MAP(CCmdAdd, CDialogEx)
END_MESSAGE_MAP()


// CCmdAdd message handlers


BOOL CCmdAdd::OnInitDialog()
{
  CDialogEx::OnInitDialog();

  for (int index=0; index<project_.num_serials(); ++index) {
    CMeasureSerial *serial = project_.serial(index);
    wnd_serial_list_.AddString(serial->Name().c_str());
  }

  return TRUE;
}
